package com.example.demo.dto;

import com.example.demo.entity.TaskType;
import java.time.LocalDateTime;

public class TaskTypeDTO {
    private Long taskTypeId; // 任务类型主键ID
    private String taskName; // 任务名称
    private String taskDescription; // 任务描述信息
    private Long dataSourceId; // 数据源ID
    private String dataSourceName; // 数据源名称
    private LocalDateTime createdAt; // 创建时间
    private LocalDateTime updatedAt; // 更新时间

    public Long getTaskTypeId() {
        return taskTypeId;
    }

    public void setTaskTypeId(Long taskTypeId) {
        this.taskTypeId = taskTypeId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getTaskDescription() {
        return taskDescription;
    }

    public void setTaskDescription(String taskDescription) {
        this.taskDescription = taskDescription;
    }

    public Long getDataSourceId() {
        return dataSourceId;
    }

    public void setDataSourceId(Long dataSourceId) {
        this.dataSourceId = dataSourceId;
    }

    public String getDataSourceName() {
        return dataSourceName;
    }

    public void setDataSourceName(String dataSourceName) {
        this.dataSourceName = dataSourceName;
    }

    public LocalDateTime getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(LocalDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    // 静态方法：从 Entity 转 DTO
    public static TaskTypeDTO fromEntity(TaskType taskType) {
        TaskTypeDTO dto = new TaskTypeDTO();
        dto.setTaskTypeId(taskType.getTaskTypeId());
        dto.setTaskName(taskType.getTaskName());
        dto.setTaskDescription(taskType.getTaskDescription());
        dto.setDataSourceId(taskType.getDataSourceId());
        dto.setDataSourceName(taskType.getDataSourceName());
        dto.setCreatedAt(taskType.getCreatedAt());
        dto.setUpdatedAt(taskType.getUpdatedAt());
        return dto;
    }
}